<script setup lang="ts">
import axios from 'axios'
import { ref, onBeforeMount } from 'vue'

const count = ref(0)
onBeforeMount(() => {
    console.log('helloWorld come in', import.meta.env.VITE_BASE_URL)
})

function test() {
    axios.get('/test').then((res) => {
        console.log(res);
        alert(JSON.stringify(res.data))
    });
}
</script>

<template>
    <el-button type="danger" @click="test">发送请求</el-button>

    <div class="card">
        <el-button type="primary" @click="count++">count is {{ count }}</el-button>
        <p>
            Edit
            <code>components/HelloWorld.vue</code> to test HMR
        </p>
    </div>

    <p>
        Check out
        <a href="https://vuejs.org/guide/quick-start.html#local" target="_blank">create-vue</a>, the official Vue + Vite
        starter
    </p>
    <p>
        Install
        <a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
        in your IDE for a better DX
    </p>
    <p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>

<style scoped>
.read-the-docs {
    color: #888;
}

.logo {
    height: 6em;
    padding: 1.5em;
    will-change: filter;
}

.logo:hover {
    filter: drop-shadow(0 0 2em #646cffaa);
}

.logo.vue:hover {
    filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
